package com.toman.Util;

import android.app.Activity;
import android.content.Context;
import android.widget.TextView;

import com.github.mikephil.charting.components.MarkerView;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.utils.MPPointF;
import com.toman.R;

import java.text.DecimalFormat;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Custom implementation of the MarkerView.
 *
 * @author Philipp Jahoda
 */
public class DoubleMarkerView extends MarkerView {

    TextView tvDay;
    TextView tvContent1;
    TextView tvContent2;

    String label[];
    float[] content, content2;

    private DecimalFormat format;

    public DoubleMarkerView(Context context, String[] x, float[] content, float[] content2) {
        super(context, R.layout.custom_marker_double);
        this.label = x;
        tvDay = (TextView) findViewById(R.id.tv_day);
        tvContent1 = (TextView) findViewById(R.id.tv_content1);
        tvContent2 = (TextView) findViewById(R.id.tv_content2);

        this.content=content;
        this.content2=content2;
    }

    // callbacks everytime the MarkerView is redrawn, can be used to update the
    // content (user-interface)
    @Override
    public void refreshContent(Entry e, Highlight highlight) {
tvDay.setText(label[(int) e.getX()]);
int num=(int)content[(int) e.getX()];
int num2=(int)content2[(int) e.getX()];

        tvContent1.setText(num+"");
        tvContent2.setText(num2+"");

        super.refreshContent(e, highlight);
    }

    @Override
    public MPPointF getOffset() {
        return new MPPointF(-(getWidth() / 2), -getHeight());
    }
}
